package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-07-26
 * Time: 17:04
 */
class MyArrays {
    public Object[] arrays = new Object[10];

    public void setArrays(int pop,Object obj) {
        this.arrays[pop] = obj;
    }
    public Object getArrays(int pop) {
        return this.arrays[pop];
    }
}

public class Main {
    public static void main(String[] args) {
        MyArrays myArrays = new MyArrays();
        myArrays.setArrays(0,10);
        myArrays.setArrays(1,"10");

        //String str = myArrays.getArrays(2);  //编译报错
        String str = (String) myArrays.getArrays(1);
        System.out.println(str);
    }
}
